#! /bin/sh

name=git
version=2.45.2
revision=1
tarball_url="https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz"
tarball_blake2b="477acc786c26e0b04843ad6d07333607b2274d587263d72c6d036cade725e6f62f8c773903f401c799de71527d0473589afc507eec02f445e0c148dd7cbf407c"
imagedeps="build-essential libcurl4-gnutls-dev"
hostdeps="gcc pkg-config"
deps="core-libs python zlib curl openssl openssh"

prepare() {
    autotools_recursive_regen
}

configure() {
    cp -rp ${source_dir}/. .

        configure_script_path=./configure \
        ac_cv_iconv_omits_bom=yes \
        ac_cv_fread_reads_directories=no \
        ac_cv_snprintf_returns_bogus=no \
    autotools_configure \
        CFLAGS="$TARGET_CFLAGS -std=gnu17" \
        --with-gitconfig=/etc/gitconfig \
        --with-python=python3
}

build() {
    make -j${parallelism}
}

package() {
    DESTDIR="${dest_dir}" make install

    post_package_strip
}
